﻿namespace Behemoth.SharePoint.Utilities {

    using System;
    using System.Collections.Generic;
    using System.Text;

    using Behemoth.Configuration;
    using Behemoth.SharePoint.Configuration;
    using Microsoft.SharePoint;

    public class ListPropertyRepairFeatureProperties : SPFeaturePropertyReaderBase {

        public ListPropertyRepairFeatureProperties(SPFeatureReceiverProperties props) : base(props) { }

        private static char[] delim = new char[] { ';' };

        [StrongTypeConfigEntryAttribute("ListFeatures", true)]
        private string delimitedListFeatureNames = string.Empty;
        private List<string> listFeatures = null;
        public List<string> ListFeatures {
            get {
                if (listFeatures == null) {
                    string[] names = delimitedListFeatureNames.Split(delim);
                    listFeatures = new List<string>(names);
                }
                return listFeatures;
            }
            set {
                listFeatures = value;
                string[] names = listFeatures.ToArray();
                delimitedListFeatureNames = string.Join(delim[0].ToString(), names);
            }
        }

    } // class

} // namespace
